<?php 
$this->load->view('admin/layout/head', array('title'=>'统计分析','nav'=>'ustatistics'), FALSE);
?>

<div id="container">
	<div class="panel panel-default">
		<div class="panel-heading">
			7天交易量统计
		</div>
		<div class="panel-body">
		    <div id="line-charts" style="width: 100%; height: 400px;"></div>
		</div>
	</div>
</div>


<?php 
$this->load->view('admin/layout/footer',['js'=>['/assets/echarts/echarts.common.min.js']]);
?>

<script type="text/javascript">
	$(function(){
		getLineData();
	})

	function getLineData(){
		$.get('/admin/ustatistics/getLineData', function(data) {
			var option = lineOption(data);
			var myChart = echarts.init(document.getElementById('line-charts'));
			myChart.setOption(option);

		});
	}

	function lineOption(json){
		return {
		   
		    tooltip: {
		        trigger: 'axis'
		    },
		    legend: {
		        data:['线上交易量','线下交易量']
		    },
		    toolbox: {
		        show: true,
		        feature: {
		            magicType: {type: ['line', 'bar']}
		        }
		    },
		    xAxis:  {
		        type: 'category',
		        boundaryGap: false,
		        data: json.dates
		    },
		    yAxis: {
		        type: 'value',
		        axisLabel: {
		            formatter: '{value}'
		        }
		    },
		    series: [
		        {
		            name:'线上交易量',
		            type:'line',
		            data:json.online,
		            markPoint: {
		                data: [
		                    {type: 'max', name: '最大值'}
		                ]
		            }
		        },
		        {
		            name:'线下交易量',
		            type:'line',
		            data:json.offline,
		            markPoint: {
		                data: [
		                    {type: 'max', name: '最大值'}
		                ]
		            }
		        }
		    ]
	}
	
};

</script>
















